import type { TableColumn, FormField } from '@/components'
import { reactive } from 'vue'

export const fields = reactive<FormField[]>([
  {
    key: 'name',
    label: '昵称',
    tag: 'ElInput'
  }
])

export const columns: TableColumn[] = [
  {
    key: 'name',
    label: '昵称'
  },
  {
    key: 'created_at',
    label: '创建日期',
    slot: true
  },
  {
    key: 'actions',
    label: '操作',
    slot: true,
    fixed: 'right'
  }
]

export const dialogFields = reactive<FormField[]>([
  {
    key: 'name',
    label: '用户名',
    tag: 'ElInput',
    required: true
  },
  {
    key: 'nickname',
    label: '姓名',
    tag: 'ElInput',
    required: true
  },
  {
    key: 'password',
    label: '密码',
    tag: 'ElInput',
    attrs: {
      type: 'password'
    },
    required: true
  },
  {
    label: '地区',
    key: 'area_id',
    tag: 'MTreeSelect',
    required: true,
    attrs: {
      props: {
        value: 'id',
        label: 'name'
      },
      data: [],
      checkStrictly: true
    }
  },
  {
    tag: 'MSelect',
    key: 'role_ids',
    label: '角色',
    attrs: {
      options: [],
      multiple: true
    }
  }
])
